package com.lagou.decimal;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class DecimalMapper extends Mapper<LongWritable, Text, DecimalBean, NullWritable> {

    @Override
    protected void map(LongWritable key, Text value, Context context) throws
            IOException, InterruptedException {
        // 1 获取一行
        String s = value.toString();
        Long l = Long.parseLong(s);
        DecimalBean decimalBean = new DecimalBean();
        decimalBean.setDecimal(l);
        context.write(decimalBean, NullWritable.get());
    }

}
